package tech.eyao.hs60x.converts;

import java.util.List;
import java.util.stream.Collectors;
import org.springframework.util.CollectionUtils;
import tech.eyao.hs60x.dto.ZoneDTO;
import tech.eyao.hs60x.model.domain.SafetyZoneDO;

public class ZoneConvert {

	public static List<ZoneDTO> convertList(List<SafetyZoneDO> list) {
		if (!CollectionUtils.isEmpty(list)) {
			return list.stream()
			.map((s)->{
				ZoneDTO zoneDTO = new ZoneDTO();
				zoneDTO.address = s.getAddress();
				zoneDTO.id = s.getId();
				zoneDTO.latitude = s.getLatitude();
				zoneDTO.longitude = s.getLongitude();
				zoneDTO.r = s.getR();
				zoneDTO.watchId = s.getWatchId();
				zoneDTO.zoneName = s.getZoneName();
				return zoneDTO;
			})
			.collect(Collectors.toList());
		}
		return null;
	}

}
